<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	
	<body>
		<img src="img/1.jpg" id="imgss">
		<br>
		<br>
		<button type="button" style="margin-left: 20px;" onclick="qh()" id="buttonss">切换图片循环</button>
	</body>
		<script type="text/javascript">
		var imgss=document.getElementById('imgss');
		var buttonss=document.getElementById('buttonss');
		
		function qh(){
		var myInerterval = setInterval(function (){
			//创建数组存放图片
			var img_sz=["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg","img/6.jpg","img/7.jpg","img/8.jpg","img/9.jpg"]
			//创建随机数
			var randNum=Math.floor(Math.random()*img_sz.length);
			
				imgss.src=img_sz[randNum];
			},200)
		}
		</script>

</html>

